<?php

class Form_QuoteForm extends Zend_Form {

    public function init() {
	$name = $this->createElement('text', 'name')
			->removeDecorator('DtDdWrapper')
			->removeDecorator('label')
			->removeDecorator('HtmlTag')
			->removeDecorator('Errors')
			->setRequired(TRUE)
			->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter name')))
			->setAttribs(Array('class' => "rounded1"));
	$this->addElement($name);

	$company = $this->createElement('text', 'company')
			->removeDecorator('DtDdWrapper')
			->removeDecorator('label')
			->removeDecorator('HtmlTag')
			->removeDecorator('Errors')
			->setAttribs(Array('class' => "rounded1"));

	$this->addElement($company);
	
	$email = $this->createElement('text', 'email')
			->removeDecorator('DtDdWrapper')
			->removeDecorator('label')
			->removeDecorator('HtmlTag')
			->removeDecorator('Errors')
			->setRequired(TRUE)
			->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Email address shouldnot be blank.')))
			->addValidator(new Zend_Validate_EmailAddress())
			->addFilters(array(
			    new Zend_Filter_StringTrim(),
			    new Zend_Filter_StringToLower()
			))
			->setAttribs(Array('class' => "rounded"));
	$email->getValidator('emailAddress')->setMessage("Email address is not valid.", Zend_Validate_EmailAddress::INVALID_FORMAT);
	$this->addElement($email);




	$country = $this->createElement('select', 'country')
			->removeDecorator('DtDdWrapper')
			->removeDecorator('label')
			->removeDecorator('HtmlTag')
			->removeDecorator('Errors')
			->setRequired(TRUE)
			->addFilters(array(
			    new Zend_Filter_StringTrim(),
			    new Zend_Filter_StringToLower()
			))
			->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select country.')))
			->setAttribs(Array('class' => "rounded"));
	$this->addElement($country);


	$phone = $this->createElement('text', 'phone')
			->removeDecorator('DtDdWrapper')
			->removeDecorator('label')
			->removeDecorator('HtmlTag')
			->removeDecorator('Errors')
			->setRequired(TRUE)
			->addFilters(array(
			    new Zend_Filter_StringTrim(),
			    new Zend_Filter_StringToLower()
			))
			->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter contact number.')))
			->setAttribs(Array('class' => "rounded"));
	$this->addElement($phone);


	$suitabletime = $this->createElement('text', 'suitabletime')
			->removeDecorator('DtDdWrapper')
			->removeDecorator('label')
			->removeDecorator('HtmlTag')
			->removeDecorator('Errors')
			->addFilters(array(
			    new Zend_Filter_StringTrim(),
			    new Zend_Filter_StringToLower()
			))
			->setAttribs(Array('class' => "rounded"));
	$this->addElement($suitabletime);


	$services = $this->createElement('select', 'services')
			->removeDecorator('DtDdWrapper')
			->removeDecorator('label')
			->removeDecorator('HtmlTag')
			->removeDecorator('Errors')
			->setRequired(TRUE)
			->addFilters(array(
			    new Zend_Filter_StringTrim(),
			    new Zend_Filter_StringToLower()
			))
			->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select services.')))
			->setAttribs(Array('class' => "rounded"));
	$this->addElement($services);
	
	$reqdetails = $this->createElement('textarea', 'reqdetails')
			->removeDecorator('DtDdWrapper')
			->removeDecorator('label')
			->removeDecorator('HtmlTag')
			->removeDecorator('Errors')
			->setRequired(TRUE)
			->setAttrib('cols', 42)
			->setAttrib('rows', 7)
			->setAttribs(Array('class' => "rounded"));
	$this->addElement($reqdetails);
	
	
	$filename = $this->createElement('file', 'filename')
			->removeDecorator('DtDdWrapper')
			->removeDecorator('label')
			->removeDecorator('HtmlTag')
			->removeDecorator('Errors')
			->addValidator('Extension', false, 'jpg,png,gif,pdf,xls,xlsx,rtf,txt,doc,docx,odt,ppt,ods')
			->addValidator('Count', false, 1);
	$filename->getValidator('Count')->setMessage('You can upload only one file');
	$filename->getValidator('Extension')->setMessage('Invalid file extension, only valid image and documents file types are allowed.');


	$this->addElement($filename);
	
	
	$submit = $this->createElement('submit', 'SEND')
			->removeDecorator('DtDdWrapper')
			->removeDecorator('label')
			->removeDecorator('HtmlTag')
			->setAttribs(Array('class' => "submit-btn"));
	$this->addElement($submit);
    }

}